/**
* @description: 作业知识助手
* @author: 姚超
* @date:
**/
<template>
  <view class="main">
    <nav-bar class="header" back :title="title" @goBack="goBack" />
    <div class="task-main">
      <van-tabs v-model="activeName" @click="chooseClick()">
        <van-tab title="全部" name="0">
          <view class="test">
            <van-collapse v-model="activeShow[0]" v-for="(item,index) in allList" :key="index" accordion>
              <van-collapse-item :title="item.HEAD" :name="index+1" size="large">{{item.CONTENT}}</van-collapse-item>
            </van-collapse>
          </view>
        </van-tab>
        <van-tab title="三级风险" name="1">
          <view class="test">
            <van-collapse v-model="activeShow[1]" v-for="(item,index) in allList" :key="index" accordion>
              <van-collapse-item :title="item.HEAD" :name="index+1"  size="large">{{item.CONTENT}}</van-collapse-item>
            </van-collapse>
          </view>
        </van-tab>
        <van-tab title="四级风险" name="2">
          <view class="test">
            <van-collapse v-model="activeShow[2]" v-for="(item,index) in allList" :key="index" accordion>
              <van-collapse-item :title="item.HEAD" :name="index+1" size="large">{{item.CONTENT}}</van-collapse-item>
            </van-collapse>
          </view>
        </van-tab>
        <van-tab title="五级风险" name="3">
          <view class="test">
            <van-collapse v-model="activeShow[3]" v-for="(item,index) in allList" :key="index" accordion>
              <van-collapse-item :title="item.HEAD" :name="index+1" size="large">{{item.CONTENT}}</van-collapse-item>
            </van-collapse>
          </view>
        </van-tab>
      </van-tabs>
    </div>
  </view>
</template>
<script>
import navBar from '../../components/common/nav-bar'

export default {
  name: 'knowledgeAssistant',
  components: {navBar},
  props: {},
  data() {
    return {
      title: '作业知识助手',
      activeName:'0',
      activeShow: {
        0: '1',
        1: '1',
        2: '1',
        3: '1',
      },
      titleSmall:'',
      allList:[]
    }
  },
  computed: {},
  watch: {},
  onLoad() {
    this.getSelectKnowK();
  },
  methods: {
    goBack() {
      uni.navigateTo({ url: '/' });
    },
    chooseClick() {
      this.getSelectKnowK()
    },
    getSelectKnowK() {
      let parasm = {
        rankCode: this.activeName
      }
      this.$api.getSelectKnow(parasm).then(res => {
        this.allList = res.data
      })
    }
  }
}
</script>
<style scoped lang="scss">
.main {
  width: 100vw;
  height: 100vh;
  background: #f2f6fa;
  overflow: hidden;
  .task-main{
    height: calc(100vh - #{px2vh(90)} - 38px);
    .test {
      padding-top: px2vh(30);
      height: calc(100vh - #{px2vh(360)});
      width: calc(100% - #{px2vw(60)});
      margin-left: px2vw(30);
      overflow: auto;
    }
  }
}
</style>